Skip to content

Conversation

localspook
Copy link
Contributor

No description provided.

@llvmbot
Copy link
Member

llvmbot commented Sep 16, 2025

@llvm/pr-subscribers-clang-tidy

@llvm/pr-subscribers-github-workflow

Author: Victor Chernyakin (localspook)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/158779.diff

2 Files Affected:

  • (modified) .github/workflows/pr-code-format.yml (+8)
  • (modified) clang-tools-extra/clang-tidy/ClangTidy.cpp (+5-2)
diff --git a/.github/workflows/pr-code-format.yml b/.github/workflows/pr-code-format.yml
index 9396bf019e1ac..607b6cf3bdfb0 100644
--- a/.github/workflows/pr-code-format.yml
+++ b/.github/workflows/pr-code-format.yml
@@ -2,6 +2,7 @@ name: "Check code formatting"
 
 permissions:
   contents: read
+  pull-requests: write
 
 on:
   pull_request:
@@ -71,6 +72,7 @@ jobs:
         run: pip install -r code-format-tools/llvm/utils/git/requirements_formatting.txt
 
       - name: Run code formatter
+        id: run-code-formatter
         env:
           GITHUB_PR_NUMBER: ${{ github.event.pull_request.number }}
           CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
@@ -91,3 +93,9 @@ jobs:
           name: workflow-args
           path: |
             comments
+
+      - uses: parkerbxyz/suggest-changes@00f556dcc0c9454336b598b8872fdc11d77984d9 #v3.0.0
+        if: steps.run-code-formatter.outcome == "failure"
+        with:
+          comment: "Formatting can be fixed by applying the following changes:"
+          event: "REQUEST_CHANGES"
diff --git a/clang-tools-extra/clang-tidy/ClangTidy.cpp b/clang-tools-extra/clang-tidy/ClangTidy.cpp
index 4c36bbccf44d9..ca50e9bffd591 100644
--- a/clang-tools-extra/clang-tidy/ClangTidy.cpp
+++ b/clang-tools-extra/clang-tidy/ClangTidy.cpp
@@ -491,8 +491,11 @@ std::vector<std::string> ClangTidyASTConsumerFactory::getCheckNames() {
 ClangTidyOptions::OptionMap ClangTidyASTConsumerFactory::getCheckOptions() {
   ClangTidyOptions::OptionMap Options;
   std::vector<std::unique_ptr<ClangTidyCheck>> Checks =
-      CheckFactories->createChecks(&Context);
-  for (const auto &Check : Checks)
+      CheckFactories->createChecks 
+      (&Context);
+  for (const 
+    
+    auto &Check : Checks)
     Check->storeOptions(Options);
   return Options;
 }

@localspook localspook force-pushed the formatting-fixes branch 4 times, most recently from 10fcc7b to f77b63d Compare September 16, 2025 05:57
Copy link

github-actions bot commented Sep 16, 2025

⚠️ C/C++ code formatter, clang-format found issues in your code. ⚠️

You can test this locally with the following command:
git-clang-format HEAD~1 --extensions cpp -- clang-tools-extra/clang-tidy/ClangTidy.cpp

⚠️
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing origin/main to the base branch/commit you want to compare against.
⚠️

View the diff from clang-format here.
changed files:
    clang-tools-extra/clang-tidy/ClangTidy.cpp

@localspook localspook force-pushed the formatting-fixes branch 4 times, most recently from 6dfbfde to f42346f Compare September 16, 2025 06:32

permissions:
contents: read
contents: write
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The base permission is "read" due to security concerns. There is a different job that reads output from "comments" file and posts giithub comment

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"issue-write.yaml"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, I saw in the debug output that the token only had read permissions, but I really couldn’t understand how, despite that, the workflow was able to create comments

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually LLM's can do a pretty good job finding this. I had the same question and claude code found it and explained very quickly.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe free-ones with code knowledge like deepwiki can do it too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants